#include"processBar.h"


void countdown()
{
    int cnt = 10;
    while(cnt >= 0)
    {
        printf("%2d\r",cnt);
        //刷新缓冲区
        fflush(stdout);
        sleep(1);
        cnt--;
    }
    printf("\n");
}


void processBar()
{
     char buff[NUM] = {'0'}; 
     char* load = "/-\\";
     int len = strlen(load);
     int cnt = 0;
     while(cnt <= 100)
     {
         printf(LIGHT_BLUE"[%-100s]"NONE"[%d%%][%c]]\r",buff,cnt,load[cnt%len]);
         fflush(stdout);
         usleep(50000);
         buff[cnt++] = BODY;
         if(cnt <= 100)
         {
            buff[cnt] = HEAD;
         }
     }
     printf("\n");
}
